<template>
	<view v-if="type == 1" class="content autnstatus-cnt">
		<image class="autnstatus-icon" src="/static/images/autn_status.png"></image>
		<view class="auth-msg f-32">恭喜您认证成功！</view>
		
		<view v-if="type == 1"  class="btn-box">
			<view class="operation-tl f-24 flexbox flexbox-center flexbox-middle"><view class="gan"></view>接下来您还可以<view class="gan"></view></view>
			<view @click="getTo('/pages/companyAuth/index')" class="btn ">认证企业</view>
			<view @click="scancode" class="btn second-style">扫码领证</view>
			<view  @click="getTo('/pages/wzcard/index')" class="btn second-style">查看网证</view>
			<view  @click="gethome('/pages/index/index')" class="btn second-style">返回首页</view>
		</view>
	</view>
	
	<view v-else class="content autnstatus-cnt">
		<image class="autnstatus-icon" src="/static/images/autn_status2.png"></image>
		<view class="auth-msg f-32 fail">认证失败</view>
		<view  class="auto-tip f-24">请核对好您的个人信息，有误信息会影响认证<br/>是否成功</view>
		<view class="btn-box">
			<!-- <view class="btn second-style" @click="gethome('/pages/index/index')">返回首页</view> -->
			<view @click="authAgain" class="btn big-btn">重新认证</view>
		</view>
	</view>

</template>

<script>
	import { scancode } from '@/static/js/utils.js'
	export default {
		data() {
			return {
				msg: '请核对好您的个人信息，有误信息会影响认证是否成功',
				type: '1', // 1成功   2 失败
				query: {}
			}
		},
		onLoad: function(e) {
			this.query = e
			this.type = e.type
			this.msg = e.msg || '请核对好您的个人信息，有误信息会影响认证是否成功'
			let ctid = e.ctid || ''
			if (ctid) {
				uni.setStorageSync('ctid', ctid);
			}
		},
		methods: {
			goback() {
				uni.navigateBack({
				    delta: 2
				});
			},
			
			getTo(url) {
				if(url == '/pages/my/index') {
					uni.switchTab({
					    url: url
					});
				} else {
					uni.navigateTo({
					    url: url
					});
				}
				
			},
			authAgain() {
				uni.navigateTo({
				    url: `/pages/openWz-step1/index?id=${this.query.id}&type=${this.query.authtype}&scan_flag=${this.query.scan_flag}&rurl=${this.query.rurl}&phone=${this.query.phone}`
				});
			},
			gethome(url) {
				uni.switchTab({
				    url: url
				});
			},
			scancode() {
				scancode(this)
			}
		}


	}
</script>

<style lang="scss" scoped>
	.autnstatus-cnt {
		text-align: center;
		.autnstatus-icon {
			width: 324rpx;
			height: 329rpx;
			margin: 91rpx auto 40rpx auto;
		}
		.auth-msg {
			color: #333333;
			font-weight: bold;
		}
		.auth-msg.fail {
			color: #FF6868;
		}
		.auto-tip {
			margin-top: 32rpx;
			margin: 32rpx 86rpx 0 86rpx;
			color: #999999;
			line-height: 36rpx;
		}
	}
	.operation-tl {
		padding: 23rpx 0 36rpx 0;
		color: #999999;
		.gan {
			width: 215rpx;
			height: 2rpx;
			margin: 0 16rpx;
			background-color:#EBEBEB;
		}
	}
	.btn-box {
		margin-top: 50rpx;
		.btn {
			display: inline-block;
			width: 460rpx;
			height: 78rpx;
			margin: 20rpx 42rpx;
			background: #0579FE;
			border: 1rpx solid #0579FE;
			border-radius: 66rpx;
			color: #FFFFFF;
			line-height: 78rpx;
			box-shadow: 0px 6px 16px 0px rgba(5, 121, 254, 0.4);
		}
		.second-style {
			background: #FFFFFF;
			color: #0579FE;
			box-shadow: none;
		}
		.big-btn {
			width: 454rpx;
			height: 93rpx;
			margin-top: 140rpx;
			background: #0579FE;
			box-shadow: 0px 6rpx 16rpx 0px rgba(5, 121, 254, 0.4);
			border-radius: 47rpx;
			line-height: 93rpx;
			font-size: 32rpx;
		}
	}
</style>
